@extends('Admin.base')
@section('css')
    <link rel="stylesheet" href="/Admin/layuiadmin/css/extend/formSelects-v4.css" media="all">
@endsection
@section('style')

@endsection
@section('content')
    <div class="layui-card">

        <div class="layui-card-header layuiadmin-card-header-auto">
            <fieldset class="layui-elem-field layui-field-title">
                <legend>会员邀请查询</legend>
            </fieldset>
        </div>
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item layui-row">
                <div class="layui-inline layui-col-xs3 layui-col-sm3 layui-col-md3">
                    <label class="layui-form-label">会员信息</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" placeholder="会员姓名、手机号码" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-inline">
                    <div class="layui-btn-group layui-input-block">
                        <button class="layui-btn layui-btn-sm layui-input-block layuiadmin-btn-admin" lay-submit
                                lay-filter="LAY-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-card-body">
            <table id="LAY-table" lay-filter="LAY-table"></table>
        </div>
    </div>
@endsection

@section('script')
    <script src="/js/ajax.js"></script>
    <script>
        layui.use(['form', 'table', 'formSelects', 'laydate'], function () {
            var $ = layui.$
                , form = layui.form
                , table = layui.table

            table.render({
                elem: '#LAY-table'
                , url: "{{route('user.userinvit')}}"
                , method: "post"
                , page: true //开启分页
                , limit: 10
                , cols: [[
                    , {
                        field: 'avatar', title: '头像', templet: function (d) {
                            return '<img src="' + d.avatar + '" />'
                        }
                    }
                    , {field: 'nickname', title: '昵称'}
                    , {field: 'sex_name', title: '性别'}
                    , {field: 'created_at', title: '注册时间'}
                    , {
                        field: 'calcLevel',
                        title: '会员等级',
                        templet: '<div>@{{d.calcLevel ? d.calcLevel : "" }}<br>@{{d.surplus_time ? d.surplus_time : ""}}</div>'
                    }
                ]]

            });


            //监听搜索
            form.on('submit(LAY-search)', function (data) {
                var field = data.field;
                //执行重载
                table.reload('LAY-table', {
                    where: field, page: {curr: 1}
                });
            });
        });
    </script>

@endsection